package com.wanmait.studentmangers.controller;

import com.wanmait.studentmangers.service.AddressinfoService;
import com.wanmait.studentmangers.vo.Addressinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("addressinfo")
@CrossOrigin
public class AddressinfoController {
    @Autowired
    private AddressinfoService addressinfoService;
    @RequestMapping("add")
    public String add( Addressinfo addressinfo) {
        addressinfoService.add(addressinfo);
        return "success";
    }
    @RequestMapping("list")
    public List<Addressinfo> list() {
        List<Addressinfo> addressinfoList  = addressinfoService.getList();
        return addressinfoList;
    }

}
